// src/router/index.ts
import { createRouter, createWebHistory, type RouteRecordRaw } from 'vue-router'
import Home from '@/views/Home.vue'

const routes: Array<RouteRecordRaw> = [
	{
		path: '/',
		name: 'Home',
		component: Home
	},
	{
		path: '/About',
		name: 'About',
		component: () => import('@/views/About.vue') // 懒加载组件
	}
]

const router = createRouter({
	history: createWebHistory(),
	routes
})

// 在这里添加路由的导航守卫
router.beforeEach((to, from, next) => {
  console.log('Navigating to:', to.path)
	console.log('Navigating from:', from.path)
  
	next()
})

export default router
